#pragma once
#include<iostream>
#include<string>
#include<sstream>
class Task
{
    public:
    Task()
    {

    }
    Task(int x,int y)
    :a(x)
    ,b(y)
    {

    }
    void Execute()
    {
        result=a+b;
    }
    void operator()()
    {

        Execute();
    }
    void Print()
    {
        std::cout<<a<<"+"<<b<<"="<<result<<std::endl;
    }
    //类+仿函数调用时不用传参数，因为参数就是类的成员变量————解耦
    std::string ResulttoString()
    {
        std::stringstream ss;
        ss<<a<<"+ "<<b<<"= "<<result;
        return ss.str();
    }
private:
    int a;
    int b;
    int result;
};